package greedy.onClass.class1.exer02;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[500];
        int len = 0;
        while (sc.hasNextInt()) {
            arr[len++] = sc.nextInt();
        }
        if (len == 1) {
            System.out.println(0);
            return;
        }
        if (arr[0] >= len - 1) {
            System.out.println(1);
            return;
        }
        int curIndex = 0;
        int jumpCount = 1;
        int curMaxExtendIndex = arr[0];
        while (curIndex <= curMaxExtendIndex) {
            int nextMaxExtendIndex = curMaxExtendIndex;
            for (int i = curIndex; i <= curMaxExtendIndex; i++) {
                if (i + arr[i] > nextMaxExtendIndex) {
                    nextMaxExtendIndex = i + arr[i];
                }
                if (nextMaxExtendIndex >= len - 1) {
                    System.out.println(jumpCount + 1);
                    return;
                }
            }
            curIndex = curMaxExtendIndex + 1;
            jumpCount++;
            curMaxExtendIndex = nextMaxExtendIndex;
        }
        sc.close();
    }
}
